package com.hunktimes.wholesale.vm

import androidx.lifecycle.MutableLiveData
import com.hunktimes.wholesale.base.BaseViewModel
import com.hunktimes.wholesale.extension.launch
import com.hunktimes.wholesale.net.WholeSaleRepository

/**
 * Author: Delete
 * Date: 2020/8/11 9:54
 * Description:
 *
 */
class HomeVM : BaseViewModel() {

    val bannerResult = MutableLiveData<List<String>>()

    fun getBanners() {
        launch({
            val resp = WholeSaleRepository.getBanners()
            val banners = resp.data
            banners?.let {
                bannerResult.value = it
            }
        })
    }

    /**
     * 首页 三个 类型 的 商品
     */
    fun getHomeData() {
        launch({
            val resp = WholeSaleRepository.getHomeData()
            val banners = resp.data
            banners?.let {
                bannerResult.value = it
            }
        })
    }
}